import { fetch } from '../../../utils/util';

export type ResponseType = Promise<defs.ResultVO<Array<defs.Menu>>>;

export const URL = '/api/menu/user/current';

/**
 * @desc 获取当前用户可访问的菜单列表
 */
export function request(
  options?: WechatMiniprogram.RequestOption,
): ResponseType {
  let url = '/api/menu/user/current';

  const fetchOption = Object.assign(
    {
      url: url,
      method: 'GET',
      headers: {
        'Content-Type': 'application/json',
      },
    },
    options,
  );
  return fetch(fetchOption);
}
